function updateBackOfficeStat (normal, amarillo) {

  document.getElementById("offer-normal").innerHTML = normal;
  document.getElementById("offer-yellow").innerHTML = amarillo;
  
}

function onclickStyler () {

  document.getElementById("style-offer").value = (document.getElementById("style-offer-checkbox").checked === true)?"Amarillo":"Normal";
  
}

function clean () {
  
  window.addEvent('domready', function() { myCal = new Calendar({ inDate:  'd/m/Y' }, { direction: 1, tweak: { x: 6, y: 0 } }); });
  window.addEvent('domready', function() { myCal = new Calendar({ outDate: 'd/m/Y' }, { direction: 1, tweak: { x: 6, y: 0 } }); });

  document.getElementById("inDate").value   = "";
  document.getElementById("outDate").value  = "";
  document.getElementById("in-night").value = "";
  
}

function changeMenu (menu) {
  
  if (menu === 'resv') {
    document.getElementById("menu-resv").className = "menu-active";
    document.getElementById("menu-prof").className = "menu-inactive";
    ShowReservaAside("elem/reservas.php", "menu-content");
    
  }
  else if (menu === 'prof') {
    document.getElementById("menu-resv").className = "menu-inactive";
    document.getElementById("menu-prof").className = "menu-active";
    ShowReservaAside("elem/profesionales.php", "menu-content");
  }
  
}

function ShowReservaAside (url, id_cont) {

  var page_req = false;

  if (window.XMLHttpRequest) { page_req = new XMLHttpRequest (); }
  else if (window.ActiveXObject) {
    try {page_req = new ActiveXObject ("Msxml2.XMLHTTP");}
    catch (e) {
      try {page_req = new ActiveXObject ("Microsoft.XMLHTTP");}
      catch (e) { }
    }
  }
  else return false;

  page_req.onreadystatechange = function () {
    LoadReservaAside(page_req, id_cont);
  };

  page_req.open('POST', url, true);
  page_req.send(null);

  return true;

}

function LoadReservaAside(page_req, id_cont) {

  if (page_req.readyState === 4 && (page_req.status === 200 || window.location.href.indexOf ("http") === - 1))
    document.getElementById(id_cont).innerHTML = page_req.responseText;
  
  window.addEvent('domready', function() { myCal = new Calendar({ inDate:  'd/m/Y' }, { direction: 1, tweak: { x: 6, y: 0 } }); });
  window.addEvent('domready', function() { myCal = new Calendar({ outDate: 'd/m/Y' }, { direction: 1, tweak: { x: 6, y: 0 } }); });

}

function updateData () {
  
  var page_req = false;

  if (window.XMLHttpRequest) { page_req = new XMLHttpRequest (); }
  else if (window.ActiveXObject) {
    try {page_req = new ActiveXObject ("Msxml2.XMLHTTP");}
    catch (e) {
      try {page_req = new ActiveXObject ("Microsoft.XMLHTTP");}
      catch (e) { }
    }
  }
  else return false;

  page_req.onreadystatechange = function () {
    LoadUpdateData(page_req, "menu-content-stat-offer");
  };

  page_req.open('POST', "elem/updateData.php", true);
  page_req.send(null);

  return true;
  
}

function LoadUpdateData(page_req, id_cont) {

  if (page_req.readyState === 4 && (page_req.status === 200 || window.location.href.indexOf ("http") === - 1))
    document.getElementById(id_cont).innerHTML = page_req.responseText;
  
}

